package com.zy.fcs.controller;

import javax.servlet.http.HttpServletRequest;

import com.alibaba.fastjson.JSONObject;

/**
 * Base Controller
 *
 * @author zhanghengchang
 * @date 2018/3/6
 */
public abstract class BaseController {

    public String render(String viewName) {
        return viewName;
    }

    public BaseController title(HttpServletRequest request, String title) {
        request.setAttribute("title", title);
        return this;
    }

    public BaseController keywords(HttpServletRequest request, String keywords) {
        request.setAttribute("keywords", keywords);
        return this;
    }

    protected JSONObject successJson() {
        JSONObject json = new JSONObject();
        json.put("success", true);

        return json;
    }
    protected JSONObject failedJson() {
        JSONObject json = new JSONObject();
        json.put("success", false);

        return json;
    }
}
